import java.io.*;

/**
 * @Author YuanYuan
 * @Date 2022/10/7
 * @Time 15:58
 */
public class Demo12 {
    //使用Pirntf来进行写操作
    public static void main(String[] args) throws IOException {

        try(OutputStream outputStream = new FileOutputStream("./bbb.txt")) {

            PrintWriter printWriter = new PrintWriter(outputStream);
            printWriter.println();
            printWriter.printf("a = %d\n", 10);
            //刷新缓冲区
            printWriter.flush();
        }
//        OutputStream outputStream = null;
//        try {
//            outputStream = new FileOutputStream("./bbb.txt");
//            PrintWriter printWriter = new PrintWriter(outputStream);
//
//            printWriter.println();
//            printWriter.printf("a = %d\n",10);
//            //刷新缓冲区
//            printWriter.flush();
//        }finally {
//            outputStream.close();
//        }
//
//
    }
}
